project(jlib)


set(CMAKE_C_FLAGS "-std=c99 ${CPU}")
set(CMAKE_CXX_FLAGS "-std=c++14 ${CPU}")

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -O0 -DLOG_LEVEL=${LOG}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -w -O2 -DLOG_LEVEL=${LOG} -DNDEBUG=1")

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0 -DLOG_LEVEL=${LOG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -w -O2 -DLOG_LEVEL=${LOG} -DNDEBUG=1")


include_directories(
  /usr/include
  /usr/local/include
  /usr/java/default/include
  /usr/java/default/include/linux
  /usr/local/opt/openssl/include
  /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/include
  /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/include/darwin
  /user/include/freetype2
)

link_directories(
  /usr/lib
  /usr/local/lib
  /usr/local/opt/openssl/lib
)

set(SOURCE
  base/obj.cpp
  base/obj_cache.cpp
  base/bit_buffer.cpp
  base/date.cpp
  base/random.cpp
  number/integer.cpp
  number/decimal.cpp
  cipher/hex.cpp
  cipher/b64.cpp
  cipher/aes.cpp
  cipher/rsa.cpp
  misc/invoke_tracker.cpp
  string/options.cpp
  graphics/gl/texture.cpp
  graphics/gl/shader.cpp
  graphics/gl/frame_buffer.cpp
  graphics/gl/buffer_object.cpp
  graphics/codec/image.cpp
  graphics/cache/texture_cache.cpp
  graphics/action/mapper.cpp
  graphics/action/action.cpp
  graphics/action/immediate_action.cpp
  graphics/action/continued_action.cpp
  graphics/node/node.cpp
  #graphics/node/camera.cpp
  #graphics/node/sprite.cpp
  #graphics/node/paint.cpp
  #graphics/node/label.cpp
  #graphics/node/space.cpp
  graphics/node/director.cpp
  graphics/manager/notification_manager.cpp
  graphics/manager/event_manager.cpp
  graphics/manager/key_manager.cpp
)


add_library(${PROJECT_NAME}_static STATIC ${SOURCE})
target_link_libraries(${PROJECT_NAME}_static crypto ssl pthread GL GLU GLEW png jpeg freetype)
SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1 VERSION 1.0 SOVERSION 1)

add_library(${PROJECT_NAME}_shared SHARED ${SOURCE})
target_link_libraries(${PROJECT_NAME}_shared crypto ssl pthread GL GLU GLEW png jpeg freetype)
SET_TARGET_PROPERTIES(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1 VERSION 1.0 SOVERSION 1)

